// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) definits fieldsfirst ansi space safe 
// Source File Name:   IRSensor.java

package jones;

import java.awt.geom.AffineTransform;
import jones.rigid.Attachable;
import jones.rigid.ConvexPolygon;
import jones.rigid.WedgePolygon;

// Referenced classes of package jones:
//            DigitalSensor, World

public class IRSensor
    implements DigitalSensor, Attachable
{

    private WedgePolygon initialSweep = null;
    private ConvexPolygon currentSweep = null;
    private AffineTransform transform = null;
    private World world = null;
    private boolean value = false;

    public IRSensor(double x, double y, double range, double angle, double orientation, World world)
    {
        currentSweep = new ConvexPolygon();
        transform = new AffineTransform();
        initialSweep = new WedgePolygon(x, y, orientation, angle, range, (int)(angle * range));
        this.world = world;
    }

    public void update(double time)
    {
        value = world.intersects(currentSweep);
    }

    public void setTransform(AffineTransform transform)
    {
        this.transform.setTransform(transform);
        currentSweep.setPolygon(((jones.rigid.Polygon) (initialSweep)));
        currentSweep.transform(transform);
    }

    public boolean getValue()
    {
        return value;
    }
}
